<template>
  <div class="process-detail">
    <div v-for="(item, idx) of items" :key="item.id" class="process-step" :style="{ flexBasis }">
      <div class="step-content">
        <div class="step-title">{{ item.name }}</div>
        <!-- <div class="step-desc" v-if="item.waitTime > 0">{{ item.waitTime }}</div> -->
      </div>
      <div class="step-arrow" v-if="idx < items.length - 1" />
    </div>
  </div>
</template>

<script>
export default {
  name: 'ProcessDetail',
  props: {
    items: { type: Array, required: true },
  },

  computed: {
    flexBasis() {
      if (this.items.length <= 8) {
        return '12.5%'
      }
      return 100 / this.items.length + '%'
    },
  },

  methods: {},
}
</script>

<style lang="scss" scoped>
.process-detail {
  display: flex;
  padding: 6px 10px;
  .process-step {
    display: flex;
    align-items: stretch;
    .step-content {
      display: flex;
      align-items: center;
      // flex-grow: 1;

      .step-title {
        padding: 0 8px;
        color: #118002;
        font-size: 16px;
      }
      .step-desc {
        position: relative;
      }
    }

    .step-arrow {
      flex-grow: 1;
      display: flex;
      justify-content: center;
      align-items: center;

      &::before,
      &::after {
        content: '';
        display: inline-block;
        position: absolute;
        height: 8px;
        width: 2px;
        background: #c0c4cc;
      }

      &::before {
        transform: rotate(-45deg) translateY(-2px);
        transform-origin: 0 0;
      }
      &::after {
        transform: rotate(45deg) translateY(2px);
        transform-origin: 100% 100%;
      }
    }
  }
}
</style>
